package com.zzyy.study.controller;

import com.zzyy.study.enums.PersonalityTraitEnum;
import dev.langchain4j.classification.EmbeddingModelTextClassifier;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @auther zzyy
 * @create 2025-03-23 16:14
 */
@RestController
@Slf4j
public class EmbedTextClassifierController
{
    @Resource
    private EmbeddingModelTextClassifier<PersonalityTraitEnum> textClassifier;


    // http://localhost:9011/textClassifier/ask
    @GetMapping(value = "/textClassifier/ask")
    public void ask()
    {

        List<PersonalityTraitEnum> personalityTraitDesc=
                textClassifier.classify("我喜欢数学，刷题高手，尤其喜欢动脑子");
        System.out.println(personalityTraitDesc);

        personalityTraitDesc=
                textClassifier.classify("喜欢一个人独处,安静的看书");

        System.out.println(personalityTraitDesc);
    }

}
